<?php

function provider_page_list(){
    global $user;
    return 'This is course page list.';
    //return theme('courses', null, variable_get('default_nodes_main', 10));
    $output = '';
    $items = array();

    if (user_access('create course entries')) {
        $items[] = l(t('Create new course.'), "node/add/course");
    }

    $output = theme('item_list', $items);

    $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'course' AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10));
    $has_posts = FALSE;

    while ($node = db_fetch_object($result)) {
        $output .= node_view(node_load($node->nid), 1);
        $has_posts = TRUE;
    }
    
    if ($has_posts) {
        $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
    }
    else {
        drupal_set_message(t('No blog entries have been created.'));
    }
    drupal_add_feed(url('courses/feed'), t('RSS - blogs'));

    return $output;
}